package com.gzw.shop.activity;

import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.gzw.shop.R;
import com.gzw.shop.utils.CartProvider;
import com.gzw.shop.widget.GToolbar;

import butterknife.BindView;
import butterknife.OnClick;

public class PayResultActivity extends BaseActivity {

    @BindView(R.id.toolbar)
    GToolbar toolbar;
    @BindView(R.id.iv_statu)
    ImageView ivStatu;
    @BindView(R.id.tv_statu)
    TextView tvStatu;
    @BindView(R.id.btn_back)
    Button btnBack;
    private int status;

    @Override
    public int getLayoutId() {
        return R.layout.activity_pay_result;
    }

    @Override
    public void initView() {
    }

    @Override
    public void initData() {

        status = getIntent().getIntExtra("status", -10);

        if (status == 1) {
            CartProvider cartProvider = new CartProvider(this);
            cartProvider.deleteAll();
            tvStatu.setText("支付成功");
            ivStatu.setImageResource(R.drawable.icon_success_128);
        } else if (status == 0) {
            tvStatu.setText("取消订单");
            ivStatu.setImageResource(R.drawable.icon_cancel_128);
        } else if (status == -2) {
            tvStatu.setText("支付失败");
            ivStatu.setImageResource(R.drawable.icon_cancel_128);
        }

    }

    @OnClick(R.id.btn_back)
    public void onViewClicked() {
        finish();
    }
}
